﻿Imports System.IO
Imports IniFile
Public Class Settings
    Public Shared UserName As String = "Guest"
    Public Shared Password As String = "Guest"
    Public Shared AutoLogin As String = "0"
    Public Shared DefaultChannel As String = "w3"
    Public Shared CurrentChannel As String = DefaultChannel
    Public Shared Server As String = "pvpgn.auscraft.cc"
    Public Shared Trigger As String = "!"
    Public Shared Version As String = "N00B Bot 1.3 By Pherein"
    Public Shared MainFormText As String = Version
    Public Shared LoggingStatus As String = "1"
    Public Shared LogEveryNumberMessages As String = "50"
    Public Shared DefaultSkin As String = "default"

    Public Shared Sub CreateSettings()
        Try
            Dim SettingsFile As New IniFile.IniFile("settings.ini", True)
            SettingsFile.AddSection("Settings")
            SettingsFile.AddKey("UserName", UserName, "Settings")
            SettingsFile.AddKey("Password", Password, "Settings")
            SettingsFile.AddKey("AutoLogin", AutoLogin, "Settings")
            SettingsFile.AddKey("DefaultChannel", DefaultChannel, "Settings")
            SettingsFile.AddKey("Server", Server, "Settings")
            SettingsFile.AddKey("Trigger", Trigger, "Settings")
            SettingsFile.AddKey("LoggingStatus", LoggingStatus, "Settings")
            SettingsFile.AddKey("LogEveryNumberMessages", LogEveryNumberMessages, "Settings")
            SettingsFile.AddKey("DefaultSkin", DefaultSkin, "Settings")
            'SettingsFile.Sort()
            SettingsFile.Save("settings.ini")
        Catch ex As Exception
            Console.WriteLine("CREATE SETTINGS FUNCTION ERROR: " + ErrorToString())
        End Try
    End Sub

    Public Shared Sub ParseSettings()
        Try
            Dim SettingsFile As New IniFile.IniFile("settings.ini", True)
            UserName = SettingsFile.GetValue("Settings", "UserName")
            Password = SettingsFile.GetValue("Settings", "Password")
            AutoLogin = SettingsFile.GetValue("Settings", "AutoLogin")
            DefaultChannel = SettingsFile.GetValue("Settings", "DefaultChannel")
            Server = SettingsFile.GetValue("Settings", "Server")
            Trigger = SettingsFile.GetValue("Settings", "Trigger")
            LoggingStatus = SettingsFile.GetValue("Settings", "LoggingStatus")
            LogEveryNumberMessages = SettingsFile.GetValue("Settings", "LogEveryNumberMessages")
            DefaultSkin = SettingsFile.GetValue("Settings", "DefaultSkin")
        Catch ex As Exception
            Console.WriteLine("PARSE SETTINGS FUNCTION ERROR: " + ErrorToString())
        End Try
    End Sub
End Class